#include <iostream>
#include "command_line_parser.hpp"
#include "reactor_client.h"

using namespace std;

int main(int argc, const char** argv)
{
    xncc::options::command_line_parser parser;
    parser
        .add_option("ip", xncc::options::value<std::string>()->default_value("127.0.0.1"), " tcp connection server ip ")
        .add_option("port", xncc::options::value<uint16_t>()->default_value(9000), " tcp connection server port ")
        .add_option("num", xncc::options::value<int>()->default_value(1), " connection  num ")
        .add_option("msg", xncc::options::value<std::string>()->default_value(""),
                    " mock send tcp connection msg data ");
    parser.parse(argc, argv);

    const auto ip   = parser.get_option_value<std::string>("ip");
    const auto port = parser.get_option_value<uint16_t>("port");
    const auto num  = parser.get_option_value<int>("num");
    const auto msg  = parser.get_option_value<std::string>("msg");

    if (parser.exist("help")) {
        std::cout << parser.help_string() << endl;
        return 0;
    }
    reactor_client client(ip, port, num);
    client.start();
    return 0;
}